import api from './config'

// 认证相关API - 基于后端AuthenticationController
export const authApi = {
  // 用户登录
  login: (credentials) => {
    const requestData = {
      account: credentials.account || credentials.username,
      password: credentials.password
    }
    return api.post('/auth/login', requestData)
  },

  // 用户注册
  register: (userData) => {
    return api.post('/auth/register', {
      account: userData.account || userData.username,
      password: userData.password,
      email: userData.email
    })
  },

  // 刷新token
  refreshToken: (token) => {
    return api.post('/auth/refresh-token', { 
      token: token 
    })
  },

  // 用户登出
  logout: () => {
    return api.post('/auth/logout')
  }
} 